#pragma once
#include "Support.h"
#include "Entity\Enemy.h"
#include "GameLayer.h"
#include "Scene\GameScene\Items\AddGoldNode.h"
#include "Scene\GameScene\Items\AddJewelNode.h"
USING_NS_CC;
using namespace CocosDenshion;

enum class EnemyState {
	RUN,
	ATTACK,
	WILLDIE,
	DIDDIE,
	FREEZE,
	StateCount
};

class EnemyNode : public Node {
public:
	static EnemyNode* createEnemyNode(const char *enemyType, Vec2 position, Node *gameLayer);
	~EnemyNode();
	int getAttack();
	int getHP();
	int getSPeed();
	void hurt(int loseHP, int knockBack);
	void hitPlayer();
	Rect getCollisionArea();
	void setState(EnemyState state);
	EnemyState getState() { return m_state; }
protected:
	bool initEnemyNode(const char *enemyType, Vec2 position, Node *gameLayer);
private:
	Node *m_gameLayer;
	bool m_effectEnable;
	Enemy *m_enemy;
	Sprite *m_showSprite;
	Sprite *m_blood;
	EnemyState m_state;
	int m_HP;

	void run();
	void attack();
	void freeze();
	void willDie();
	void didDie();
};